package com.lft.recursion01;

public class Recursion {
	public static void main(String[] args) {
		test(10);
		System.out.println("=========");
		System.out.println(factorial(10));
	}
	
	/**
	 * 打印问题
	 * @param n 数值
	 */
	public static void test(int n) {
		if (n > 2) {
			test(n - 1);
		}
		System.out.println("n= " + n);
	}
	
	/**
	 * 阶乘
	 * @param n 数值
	 * @return
	 */
	public static int factorial(int n) {
		if (n == 1) {
			return 1;
		} else {
			return factorial(n - 1) * n;
		}
	}
}
